package com.pt25.study.example.domain.sharding.factory;

import com.pt25.study.example.domain.sharding.ddo.*;
import com.pt25.study.example.repository.sharding.po.*;
import org.springframework.stereotype.Component;


@Component
public class ShardingFactory {
    public ShardingTestPo ShardingTest2ShardingTestPo(ShardingTest shardingTest) {
        ShardingTestPo shardingTestPo = ShardingTestPo.builder()
                .name(shardingTest.getName())
                .build();
        shardingTestPo.setId(shardingTest.getId());
        return shardingTestPo;
    }

    public ShardingMsPo ShardingMs2ShardingMsPo(ShardingMs shardingMS) {
        ShardingMsPo shardingMSPO = ShardingMsPo.builder()
                .name(shardingMS.getName())
                .build();
        shardingMSPO.setId(shardingMS.getId());
        return shardingMSPO;
    }

    public ShardingSdPo ShardingSD2ShardingSDPO(ShardingSd shardingSD) {
        ShardingSdPo shardingSDPO = ShardingSdPo.builder()
                .name(shardingSD.getName())
                .build();
        shardingSDPO.setId(shardingSD.getId());
        return shardingSDPO;
    }

    public ShardingSdstPo ShardingSdst2ShardingSdstPo(ShardingSdst shardingSDST) {
        ShardingSdstPo shardingSDSTPO = ShardingSdstPo.builder()
                .name(shardingSDST.getName())
                .build();
        shardingSDSTPO.setId(shardingSDST.getId());
        return shardingSDSTPO;
    }

    public ShardingSdstmsPo ShardingSdstms2ShardingSdstmsPo(ShardingSdstms shardingSDSTMS) {
        ShardingSdstmsPo shardingSDSTMSPO = ShardingSdstmsPo.builder()
                .name(shardingSDSTMS.getName())
                .build();
        shardingSDSTMSPO.setId(shardingSDSTMS.getId());
        return shardingSDSTMSPO;
    }

    public ShardingSPo ShardingS2ShardingSPo(ShardingS shardingS) {
        ShardingSPo shardingSPO = ShardingSPo.builder()
                .name(shardingS.getName())
                .build();
        shardingSPO.setId(shardingS.getId());
        return shardingSPO;
    }
}
